package com.jsbs.iam.ident.mapper;

import com.jsbs.iam.ident.entity.IamPasswordStrategy;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface IamPasswordStrategyMapper {
    int deleteByPrimaryKey(Long id);

    int insert(IamPasswordStrategy record);

    /**
     * 新增密码策略
     * @param record
     * @return
     */
    int insertSelective(IamPasswordStrategy record);

    IamPasswordStrategy selectByPrimaryKey(Long id);

    /**
     * 策略修改
     * @param record
     * @return
     */
    int updateByPrimaryKeySelective(IamPasswordStrategy record);

    int updateByPrimaryKey(IamPasswordStrategy record);

    /**
     * 全量查询密码策略
     * @return
     */
    List<IamPasswordStrategy> getIamPasswordStrategyList(
            @Param("strategyNameOrCode") String passwordStrategyName,
            @Param("companyCode") String companyCode);


    /**
     * 根据策略名称批量删除策略(伪删除，实际更新状态)
     * @param strategyCodeList
     * @return
     */
    int updateBatchDeleted (@Param("strategyCodeList") List<String> strategyCodeList,
                            @Param("companyCode") String companyCode);

    /**
     * 根据策略名称精确查询策略信息
     */
    IamPasswordStrategy getStrategyName (@Param("passwordStrategyName") String passwordStrategyName,
                                         @Param("companyCode") String companyCode);

    /**
     * 根据应用类型查询
     */
    IamPasswordStrategy getApplyTypeCode (@Param("applyTypeCode") String applyTypeCode,
                                          @Param("companyCode") String companyCode);

    /**
     * 密码策略编码自增序列
     * @return
     */
    Integer getPasswordStrategyCode();

}